package com.santu.edu.supporter.biz.school.service.impl;

import com.santu.edu.supporter.biz.school.dao.SchoolDao;
import com.santu.edu.supporter.biz.school.pojo.dto.SchoolDTO;
import com.santu.edu.supporter.biz.school.service.SchoolService;
import com.santu.edu.supporter.util.UuidUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author luoyaoqi
 * @createTime 2024/2/21
 * @description
 */
@Service
@RequiredArgsConstructor
public class SchoolServiceImpl implements SchoolService {

    private final SchoolDao schoolDao;
    @Override
    public Boolean addSchool(String schoolName) {
        String schoolId = UuidUtils.getUuid(8);
        SchoolDTO dto = SchoolDTO.createItem(schoolId, schoolName);
        schoolDao.addSchool(dto);
        return true;
    }

    @Override
    public List<SchoolDTO> getSchoolIdByName(String schoolName) {
        return schoolDao.getSchoolIdByName(schoolName);
    }

    @Override
    public SchoolDTO getSchoolById(String schoolId) {
        return schoolDao.getSchoolById(schoolId);
    }
}
